<?php

session_start();

if (isset($_SESSION['username'])) {
    ?>
    <!DOCTYPE html>
    <!--
    To change this license header, choose License Headers in Project Properties.
    To change this template file, choose Tools | Templates
    and open the template in the editor.
    -->
    <html>
        <head>
            <title>&alpha;-Voting</title>
            <script type="text/javascript" src="js/jquery-2.1.1.js"></script>

            <script type="text/javascript" src="js/bootstrap.min.js"></script>
            <script type="text/javascript" src="js/vote.js"></script>
            <link rel="shortcut icon" href="img/checked.png">

            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <link rel="stylesheet" href="css/bootstrap.css" type="text/css">
            <link rel="stylesheet" href="css/bootstrap-responsive.css" type="text/css">
            <link rel="stylesheet" href="css/bootstrap-responsive.min.css" type="text/css">
            <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css">
            <link rel="stylesheet" href="css/style.css" type="text/css">
            <link rel="stylesheet" href="css/style2.css" type="text/css">
            <style type="text/css"> 

                @font-face {   font-family: 'Glyphicons Halflings';   
                               src: url('/fonts/glyphicons-halflings-regular.eot');   
                               src: url('/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), 
                                   url('/fonts/glyphicons-halflings-regular.woff') format('woff'),  
                                   url('/fonts/glyphicons-halflings-regular.ttf') format('truetype'), 
                                   url('/fonts/glyphicons-halflings-regular.svg#glyphicons-halflingsregular') format('svg'); } 
                </style>
            </head>
            <body>

                <!-- VISI MISI DEMO -->
                <div class="modal fade" id="myModal-Demo" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                        </div>
                        <div class="modal-body">
                            <h3>Visi</h3>
                            <hr>
                            <ul>
                                <li>
                                    Visi Utama Kandidat
                                </li>
                            </ul>
                            <h3>Misi</h3>
                            <hr>
                            <ol>
                                <li>
                                    Misi 1 Kandidat
                                </li>
                                <li>
                                    Misi 2 Kandidat
                                </li>
                                <li>
                                    Misi 3 Kandidat
                                </li>
                                <li>
                                    Misi 4 Kandidat
                                </li>
                            </ol>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                        </div>
                    </div>
                </div>
            </div> 
                
            <div class="span12" id="container2">
                <form id="formvote" role="form" method="post" action="validate.php">
                    <div><h1> Calon Ketua SEMA STIS</h1><hr></div>
                    <?php
                    $kandidatSema = 1;

                    while ($kandidatSema<=2) {
                        ?>
                        <label class="radio-inline">
                            <input type="radio" id="sema" name="sema" value="Kandidat Sema <?php $kandidatSema ?>">
                            <div class="kotakcalon">
                                <div id="overlay">
                                    <span id="plus">+</span>
                                </div>
                                <img src="./img/dummy_sema.jpg" style="width: 256px;margin:0 px;">
                                <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal-Demo">
                                    VisiMisi
                                </button>
                            </div>
                        </label>
                    <?php $kandidatSema++;} ?>

                    <div><h1> Calon Ketua Tingkat STIS</h1><hr></div>
                    <?php

                    $kandidatTingkat = 1;?>
                    <?php
                        while ($kandidatTingkat<=3) {
                            ?>
                        <label class="radio-inline">
                            <input type="radio" id="ketuatingkat" name="ketuatingkat" value="Kandidat Tingkat <?php $kandidatTingkat ?>">
                            <div class="kotakcalon">
                                <img src="./img/person_dummy.jpg" ><br>
                                <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal-Demo">
                                    VisiMisi
                                </button> 
                            </div>
                        </label>
                    <?php $kandidatTingkat++;} ?>

                    <div class="span12" id="container2">
                        <br>
                        <button  id="submit" type="submit" class="btn-success btn-lg" onclick="submit">SUBMIT</button>
                    </div>
                </form>
            </div>

            <script>     
                $(document).ready(function() {
                    $("#submit").attr('disabled', 'disabled');
                $('input[name="sema"]').on('change', function() {
                    //alert("bisa");
                    if ($('input[name="ketuatingkat"]').is(":checked") && true){
                        $("#submit").removeAttr('disabled');
                        //$(#submit).prop('disabled', false);
                    }
                });
                
                $('input[name="ketuatingkat"]').on('change', function() {
                    if ($('input[name="sema"]').is(":checked") && true){
                        $("#submit").removeAttr('disabled');
                    }    
                });
                });
            </script>

            <footer id="foter">
                <b>&COPY;STISAlfa 2015</b>
            </footer>
        </body>
    </html>
    <?php
} else {
    
}
?>
